Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
Why doesn't "console.log()" work on this website?

I can open the Chrome DevTools console for this URL: https://www.google.com/ and enter the following command to print "Hello world!" to the console:

console.log("Hello world!")

However, when I attempt to use the same command for this URL: https://svc.mt.gov/dor/property/prc my message isn't printed in the console. Why is that?

Is there any way to force the console to work for this MT website?

I've tried using python/selenium to open the page and execute_script() to issue the command, but that hasn't worked either.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If you do

console.dir(console.log)

and click on the [[FunctionLocation]], you'll see the following in the site's source code:

"Debug" != e && (window.console.log = function() {}
    )

Seems like a cheap (but lazy?) way to suppress logging on production.

One way to fix it, kinda, would be to use one of the many other console commands. (console.dir, or console.error, if you want)

If you really want the original console.log to work again, the only way to do that would be to run code before the page code runs, so that you can save a reference to the function. For example, with a userscript:

// <metadata block...>
// @grant none
// ==/UserScript==

const origConsoleLog = console.log;
// set original window.console.log back to its original
// after the page loads
setTimeout(() => {
  window.console.log = origConsoleLog;
}, 2000);

// there are more elegant but more complicated approaches too
about 4 years ago · Juan Pablo Isaza Relatório

0

CertainPerformance already explained how this is possible and what the reason for suppressing the log seems to be. I'm going to show here another method to get back console.log after the original has been lost.

document.body.appendChild(document.createElement('IFRAME')).onload = function () {
    this.contentWindow.console.log('Hello, World!');
    this.remove();
};

This basically uses an old method of restoring global objects from a temporary iframe.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda